3.20 \(\int \frac{\csc ^2(x)}{(a \cos (x)+b \sin (x))^2} \, dx\)

Optimal. Leaf size=49 \[ -\frac{\frac{b}{a^2}+\frac{1}{b}}{a+b \tan (x)}-\frac{2 b \log (\tan (x))}{a^3}+\frac{2 b \log (a+b \tan (x))}{a^3}-\frac{\cot (x)}{a^2} \]

[Out]

-(Cot[x]/a^2) - (2*b*Log[Tan[x]])/a^3 + (2*b*Log[a + b*Tan[x]])/a^3 - (b^(-1) + b/a^2)/(a + b*Tan[x])

________________________________________________________________________________________

Rubi [A]  time = 0.0761826, antiderivative size = 49, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 16, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.125, Rules used = {3087, 894} \[ -\frac{\frac{b}{a^2}+\frac{1}{b}}{a+b \tan (x)}-\frac{2 b \log (\tan (x))}{a^3}+\frac{2 b \log (a+b \tan (x))}{a^3}-\frac{\cot (x)}{a^2} \]

Antiderivative was successfully verified.

[In]

Int[Csc[x]^2/(a*Cos[x] + b*Sin[x])^2,x]

[Out]

-(Cot[x]/a^2) - (2*b*Log[Tan[x]])/a^3 + (2*b*Log[a + b*Tan[x]])/a^3 - (b^(-1) + b/a^2)/(a + b*Tan[x])

Rule 3087

Int[sin[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symb
ol] :> Dist[1/d, Subst[Int[(x^m*(a + b*x)^n)/(1 + x^2)^((m + n + 2)/2), x], x, Tan[c + d*x]], x] /; FreeQ[{a,
b, c, d}, x] && IntegerQ[n] && IntegerQ[(m + n)/2] && NeQ[n, -1] &&  !(GtQ[n, 0] && GtQ[m, 1])

Rule 894

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))^(n_)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIn
tegrand[(d + e*x)^m*(f + g*x)^n*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[e*f - d*g, 0] &&
NeQ[c*d^2 + a*e^2, 0] && IntegerQ[p] && ((EqQ[p, 1] && IntegersQ[m, n]) || (ILtQ[m, 0] && ILtQ[n, 0]))

Rubi steps

\begin{align*} \int \frac{\csc ^2(x)}{(a \cos (x)+b \sin (x))^2} \, dx &=\operatorname{Subst}\left (\int \frac{1+x^2}{x^2 (a+b x)^2} \, dx,x,\tan (x)\right )\\ &=\operatorname{Subst}\left (\int \left (\frac{1}{a^2 x^2}-\frac{2 b}{a^3 x}+\frac{a^2+b^2}{a^2 (a+b x)^2}+\frac{2 b^2}{a^3 (a+b x)}\right ) \, dx,x,\tan (x)\right )\\ &=-\frac{\cot (x)}{a^2}-\frac{2 b \log (\tan (x))}{a^3}+\frac{2 b \log (a+b \tan (x))}{a^3}-\frac{\frac{1}{b}+\frac{b}{a^2}}{a+b \tan (x)}\\ \end{align*}

Mathematica [A]  time = 0.194669, size = 76, normalized size = 1.55 \[ \frac{a^2 \left (-\cot ^2(x)\right )+a^2+2 b^2 \log (a \cos (x)+b \sin (x))-a b \cot (x) (-2 \log (a \cos (x)+b \sin (x))+2 \log (\sin (x))+1)-2 b^2 \log (\sin (x))+b^2}{a^3 (a \cot (x)+b)} \]

Antiderivative was successfully verified.

[In]

Integrate[Csc[x]^2/(a*Cos[x] + b*Sin[x])^2,x]

[Out]

(a^2 + b^2 - a^2*Cot[x]^2 - 2*b^2*Log[Sin[x]] - a*b*Cot[x]*(1 + 2*Log[Sin[x]] - 2*Log[a*Cos[x] + b*Sin[x]]) +
2*b^2*Log[a*Cos[x] + b*Sin[x]])/(a^3*(b + a*Cot[x]))

________________________________________________________________________________________

Maple [A]  time = 0.118, size = 60, normalized size = 1.2 \begin{align*} -{\frac{1}{b \left ( a+b\tan \left ( x \right ) \right ) }}-{\frac{b}{{a}^{2} \left ( a+b\tan \left ( x \right ) \right ) }}+2\,{\frac{b\ln \left ( a+b\tan \left ( x \right ) \right ) }{{a}^{3}}}-{\frac{1}{{a}^{2}\tan \left ( x \right ) }}-2\,{\frac{b\ln \left ( \tan \left ( x \right ) \right ) }{{a}^{3}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(x)^2/(a*cos(x)+b*sin(x))^2,x)

[Out]

-1/b/(a+b*tan(x))-1/a^2*b/(a+b*tan(x))+2*b*ln(a+b*tan(x))/a^3-1/a^2/tan(x)-2*b*ln(tan(x))/a^3

________________________________________________________________________________________

Maxima [A]  time = 1.25928, size = 84, normalized size = 1.71 \begin{align*} -\frac{a b +{\left (a^{2} + 2 \, b^{2}\right )} \tan \left (x\right )}{a^{2} b^{2} \tan \left (x\right )^{2} + a^{3} b \tan \left (x\right )} + \frac{2 \, b \log \left (b \tan \left (x\right ) + a\right )}{a^{3}} - \frac{2 \, b \log \left (\tan \left (x\right )\right )}{a^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2/(a*cos(x)+b*sin(x))^2,x, algorithm="maxima")

[Out]

-(a*b + (a^2 + 2*b^2)*tan(x))/(a^2*b^2*tan(x)^2 + a^3*b*tan(x)) + 2*b*log(b*tan(x) + a)/a^3 - 2*b*log(tan(x))/
a^3

________________________________________________________________________________________

Fricas [B]  time = 0.528474, size = 346, normalized size = 7.06 \begin{align*} \frac{2 \, a^{2} \cos \left (x\right )^{2} + 2 \, a b \cos \left (x\right ) \sin \left (x\right ) - a^{2} +{\left (b^{2} \cos \left (x\right )^{2} - a b \cos \left (x\right ) \sin \left (x\right ) - b^{2}\right )} \log \left (2 \, a b \cos \left (x\right ) \sin \left (x\right ) +{\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}\right ) -{\left (b^{2} \cos \left (x\right )^{2} - a b \cos \left (x\right ) \sin \left (x\right ) - b^{2}\right )} \log \left (-\frac{1}{4} \, \cos \left (x\right )^{2} + \frac{1}{4}\right )}{a^{3} b \cos \left (x\right )^{2} - a^{4} \cos \left (x\right ) \sin \left (x\right ) - a^{3} b} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2/(a*cos(x)+b*sin(x))^2,x, algorithm="fricas")

[Out]

(2*a^2*cos(x)^2 + 2*a*b*cos(x)*sin(x) - a^2 + (b^2*cos(x)^2 - a*b*cos(x)*sin(x) - b^2)*log(2*a*b*cos(x)*sin(x)
 + (a^2 - b^2)*cos(x)^2 + b^2) - (b^2*cos(x)^2 - a*b*cos(x)*sin(x) - b^2)*log(-1/4*cos(x)^2 + 1/4))/(a^3*b*cos
(x)^2 - a^4*cos(x)*sin(x) - a^3*b)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\csc ^{2}{\left (x \right )}}{\left (a \cos{\left (x \right )} + b \sin{\left (x \right )}\right )^{2}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)**2/(a*cos(x)+b*sin(x))**2,x)

[Out]

Integral(csc(x)**2/(a*cos(x) + b*sin(x))**2, x)

________________________________________________________________________________________

Giac [A]  time = 1.11624, size = 85, normalized size = 1.73 \begin{align*} \frac{2 \, b \log \left ({\left | b \tan \left (x\right ) + a \right |}\right )}{a^{3}} - \frac{2 \, b \log \left ({\left | \tan \left (x\right ) \right |}\right )}{a^{3}} - \frac{a^{2} \tan \left (x\right ) + 2 \, b^{2} \tan \left (x\right ) + a b}{{\left (b \tan \left (x\right )^{2} + a \tan \left (x\right )\right )} a^{2} b} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2/(a*cos(x)+b*sin(x))^2,x, algorithm="giac")

[Out]

2*b*log(abs(b*tan(x) + a))/a^3 - 2*b*log(abs(tan(x)))/a^3 - (a^2*tan(x) + 2*b^2*tan(x) + a*b)/((b*tan(x)^2 + a
*tan(x))*a^2*b)